import java.util.PriorityQueue;
class MyTask implements Comparable<MyTask>{
private Runnable runnable;
private long time;
public MyTask(Runnable runnable,long delay){

    this.runnable = runnable;
    this.time = System.currentTimeMillis()+delay;
}

    @Override
    public int compareTo(MyTask o) {
        return (int)(this.time-o.time);
    }
    public void run(){
    runnable.run();
    }
}

class MyTimer{
    //负责扫描队列,任务的线程
     private Thread t = null;
    //任务队列
    private PriorityQueue<MyTask> queue = new PriorityQueue<>();
    public void schedule(Runnable runnable,long delay){
        MyTask myTask = new MyTask(runnable,delay);
        queue.add(myTask);
    }
    public MyTimer(){
        
    }
}
public class Demod1 {
    public static void main(String[] args) {

    }
}
